-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Natalie Tan] Duke Increments #344
base: master
Are you sure you want to change the base?
Conversation
Add toolVersion block in to Gradle code sample to prevent errors.
Change file mode on `gradle` to be executable (#9)
Gradle defaults to an empty stdin which results in runtime exceptions when attempting to read from `System.in`. Let's add some sensible defaults for students who may still need to work with the standard input stream.
Add configuration for console applications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Natalie!
Basic functionalities are implemented. Comments are helpful for understanding the code.
Please refer to the individual comments for the specifics.
Don't forget to finish the leftover increments in time ;)
src/main/java/Duke.java
Outdated
@@ -1,10 +1,10 @@ | |||
import java.util.Scanner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import :)
src/main/java/DukeBot.java
Outdated
public class DukeBot { | ||
private Scanner in; | ||
private TaskList taskList = new TaskList(); | ||
private static final String welcomeMessage = "What can I do for you?"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the coding standard:
Constant names must be all uppercase using underscore to separate words.
src/main/java/DukeBot.java
Outdated
* Starts DukeBot and prints welcome message. | ||
*/ | ||
|
||
public void initialise() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These code should be in the constructor and run
can be a public method that can be called separately IMO.
src/main/java/DukeBot.java
Outdated
*/ | ||
|
||
public void initialise() { | ||
String logo = " ____ _ \n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be a constant too.
src/main/java/DukeBot.java
Outdated
input = in.nextLine(); | ||
if (input.equals("bye")) { | ||
// if "bye", terminate | ||
// todo: is there a way to combine this into processInput()? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can make processInput
return a boolean to indicate whether the command is "bye"
src/main/java/TaskList.java
Outdated
* | ||
* @param input input string given by user. | ||
*/ | ||
public void processInput(String input) throws InputMismatchException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having almost all the app logic here, maybe it would help to define a Command
class and a few subclasses like AddCommand
, DoneCommand
, etc. It would make the code more maintainable.
src/main/java/TaskList.java
Outdated
|
||
public void printList() { | ||
int i = 1; | ||
for (Iterator<Task> iterator = this.tasks.iterator(); iterator.hasNext(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the iterator here is necessary :)
src/main/java/TaskList.java
Outdated
tasks.add(newTask); | ||
System.out.println("Okay! I've added: " + description | ||
+ ". Use list to see all your tasks!"); | ||
// todo: description has trailing space due to using /at or /by as delimiter. how? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strip()
, stripLeading()
, stripTrailing()
, whichever that suits your need :)
src/main/java/TaskList.java
Outdated
TODO | ||
} | ||
|
||
public void addToList(TaskType taskType, String description, String deadline) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make this method take in a Task
and construct the Task
at the call site. This reduces duplicate code.
src/main/java/TaskList.java
Outdated
} | ||
break; | ||
case "event": | ||
inputReader.useDelimiter("/at"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty neat :)
src/main/java/Duke.java
Outdated
@@ -1,10 +1,10 @@ | |||
import java.util.Scanner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
…to implement A-MoreOOP
…mentation(s) of execute() from previous version. currently unable to run: encountered "could not find or load main class Duke" error :(
…t Level-9 (find), fix String comparison bug
…his.tasks" with "tasks" in TaskList.java
…ddToList method and replace with calls to newTask() and add()
…geBox to represent different types of message boxes. change Gui class to use these subclasses.
Branch-Level-10
…GuiDuke, build Jar file
Branch level 10
* 'master' of https://github.com/nattanyz/duke: (22 commits) remove redundant print statements in Task class, change filePath for GuiDuke, build Jar file remove System.out.println statements. add SaveCommand add showUserInput() method to Gui class add DukeMessageBox, ExceptionMessageBox, TaskMessageBox and UserMessageBox to represent different types of message boxes. change Gui class to use these subclasses. add Storage param back to execute() method in all Commands, add storage.save() when ExitCommand() is issued use ui.showMessage() in Storage class, add try/catch blocks to debug, manage to get partially working GUI (yay!) partially implement GUI using messageBoxQueue. changed font family and size. add DropShadow to MessageBox. complete refactoring from previous commit, add GREY colour scheme fix VBox width issue, complete refactoring of dialogBox to messageBox refactor: rename DialogBox to MessageBox.add ColourScheme enum to take care of customisable colour schemes. configure getUserDialog and getDukeDialog to use background and text colour create CliDuke and GuiDuke classes to implement Duke interface, set default invocation of Duke from CLI to use CliDuke and GUI to use GuiDuke continue refactoring in earlier commit replace Ui class with Ui interface and Cli and Gui implementations, attempt to do the same for Duke refactor: organise methods in Duke class fix scrolling and resizing behaviour of MainWindow, add some JavaDoc refactor: move GUI-related classes to duke.gui, add title and application icon rectify MainWindow fit wrap TextField and Button in HBox change images to png (but still cannot get them to appear) manage to compile and run, opens GUI window ...
Branch tests and assertions
…-Tests-and-Assertions * 'master' of https://github.com/nattanyz/duke: Set theme jekyll-theme-cayman
No description provided.